# -*- coding: utf-8 -*-
"""
@Time：YourTime
@Author  : YourName
@Desc    : 
"""
import requests
from config.setting import webhook

def send_qw_msg(content, at_all = True):
    """
    向企业微信发送消息
    at_all=True：会艾特所有人
    """
    qw_url = webhook
    data = {
        'msgtype': 'text',
        'text': {
            'content': content
        },
        'at': {
            'isAtAll': at_all
        }
    }
    headers = {
        'Content-Type': 'application/json;charset=UTF-8'
    }
    res = requests.post(url = qw_url, json = data, headers = headers)
    return res.text


print(send_qw_msg('123'))
